package com.it.filter;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2024/10/23 17:44
 */
@Component
public class CustomFilter implements Filter {
    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
            throws IOException, ServletException {

        HttpServletResponse response = (HttpServletResponse) res;

        // 移除 Cache-Control 和 Pragma 头部
        response.setHeader("Cache-Control", "");
        response.setHeader("Pragma", "");
        response.setHeader("vary", null);

        chain.doFilter(req, response);
    }
    // 其他必要的方法可以留空
}
